import request from '@/utils/request'
import { ParamsData, orderTableRes } from '@/model/order/AllOrder'
import { AfterSaleParams } from '@/model/order/AfterSale'

// 枚举接口地址

enum Api {
  ORDER_TABLE = '/api/order/page',
  AFTER_SALE_TABLE = '/api/order/afterSale/page',
  AFTER_SALE_EXPORT = '/api/order/afterSale/export',
  AFTER_SALE_REIMBURSE = '/api/order/afterSale/reimburse',
}

/**
 * @description: 获取订单表格数据
 * @param {ParamsData} data
 * @return {orderTableRes}
 */
export const getOrderTableData = (data: ParamsData) => request.get<orderTableRes>(Api.ORDER_TABLE, data)

/**
 * @description: 获取售后订单表格数据
 * @param {AfterSaleParams} data
 * @return {*}
 */
export const getAfterSaleTableData = (data: AfterSaleParams) => request.get(Api.AFTER_SALE_TABLE, data)

/**
 * @description: 导出订单
 * @param {AfterSaleParams} data
 * @return {*}
 */
export const exportAfterSaleOrder = (data: AfterSaleParams) => request.get(Api.AFTER_SALE_EXPORT, data)

/**
 * @description: 退款操作
 * @param {object} data
 * @return {*}
 */
export const judgeReimburse = (data: object | undefined) => request.patch(Api.AFTER_SALE_REIMBURSE, data)
